#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2021/7/20 16:03
# @Author  : Samge
from PyQt5.QtWidgets import QMessageBox


def show_tip(self, content, title='温馨提示', need_close=False, tip_type=QMessageBox.information):
    """
    展示普通弹窗提示
    :param self: 当前窗口对象
    :param content: 提示内容
    :param title: 提示标题
    :param need_close: 提示完毕是否需要关闭当前窗口
    :param tip_type: 弹窗类型
    :return:
    """
    reply = QMessageBox.information(self, title, content, QMessageBox.Ok)
    if tip_type is QMessageBox.question:
        reply = QMessageBox.question(self, title, content, QMessageBox.Ok)
    elif tip_type is QMessageBox.warning:
        reply = QMessageBox.warning(self, title, content, QMessageBox.Ok)
    elif tip_type is QMessageBox.critical:
        reply = QMessageBox.critical(self, title, content, QMessageBox.Ok)
    elif tip_type is QMessageBox.about:
        reply = QMessageBox.about(self, title, content, QMessageBox.Ok)
    if need_close:
        self.echo(reply)   # 如果需要同时退出父窗口，则使用该语句
